<template>
	<view>
		<uni-card :is-shadow="false" is-full>
			<text class="uni-h6">资产</text>
		</uni-card>
		<uni-section title="人脉信息" type="line">
			<view class="example">
				<!-- 基础用法，不包含校验规则 -->
				<uni-forms ref="baseForm" :modelValue="recordAsset">
					<uni-forms-item label="类型:">
						<view class="detail-item">{{recordAsset.assetType}}</view>
					</uni-forms-item>
					<uni-forms-item label="名称:">
						<view class="detail-item">{{recordAsset.assetName}}</view>
					</uni-forms-item>
					<uni-forms-item label="数量:">
						<view class="detail-item">{{recordAsset.count}}</view>
					</uni-forms-item>
					<uni-forms-item label="单位:">
						<view class="detail-item">{{recordAsset.unit}}</view>
					</uni-forms-item>
					<uni-forms-item label="价值:">
						<view class="detail-item">{{recordAsset.money}}</view>
					</uni-forms-item>
					<uni-forms-item label="备注:">
						<view class="detail-item">{{recordAsset.remark}}</view>
					</uni-forms-item>
				</uni-forms>
			</view>
		</uni-section>
	</view>
</template>

<script>
import {
		getAsset
	} from '@/api/record/asset.js'
	import {
		getDictDataList
	} from '@/api/system/dict.js'
	export default {
		data() {
			return {
				recordAsset: {},
				dictQuery: {
					pageNum: 1,
					pageSize: 100,
					dictType: "asset_type"
				}
			}
		},
		onLoad(event) {
			console.log("eventeventeventevent");
			console.log(event);
			this.getAssetDetail(event.assetId);
		},
		methods: {
			getAssetDetail(id) {
				var that = this;
				getAsset(id).then(response => {
					console.log(response)
					that.recordAsset = response.data;
					getDictDataList(that.dictQuery).then(response => {
						var temp = response.rows;
						console.log("--getDictDataList--")
						console.log(temp)
						for (var i = 0; i < temp.length; i++) {
							console.log(temp[i].dictType)
							if(temp[i].dictValue == that.recordAsset.assetType){
								that.recordAsset.assetType = temp[i].dictLabel;
								break;
							}
						}
					});
				});
			},
			getDict() {
				var that = this;
			}
		}
	}
</script>

<style>
	.example {
		padding: 15px;
		background-color: #fff;
	}

	.segmented-control {
		margin-bottom: 15px;
	}

	.button-group {
		margin-top: 15px;
		display: flex;
		justify-content: space-around;
	}

	.form-item {
		display: flex;
		align-items: center;
	}

	.button {
		display: flex;
		align-items: center;
		height: 35px;
		margin-left: 10px;
	}

	.detail-item {
		height: 100%;
		flex: auto;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}
</style>